package com.vitabuybuy.tv.dto;

import androidx.databinding.BaseObservable;
import androidx.databinding.Bindable;

import com.vitabuybuy.tv.BR;
import com.vitabuybuy.tv.utils.LanaugeUtils;

/**
 * 作者：SimGa
 * 日期：2021/1/6
 * 时间：17:28
 * 包名：com.vitabuybuy.tv.dto
 */
public class CouponCenterDto extends BaseObservable {

    /**
     * useEndTime : 2021-01-30
     * useStartTime : 2020-12-23
     * scope : 全部商品
     * name : 测试优惠券
     * discount : 50
     * received : true
     * id : 9
     * precondition : 0
     */

    private String useEndTime;
    private String receiveEndTime;
    private String receiveStartTime;
    private String useStartTime;
    private String scope;
    private String name;
    private double discount;
    @Bindable
    private boolean received;
    private int id;
    private int precondition;
    private String type;

    public String getReceiveEndTime() {
        return receiveEndTime;
    }

    public void setReceiveEndTime(String receiveEndTime) {
        this.receiveEndTime = receiveEndTime;
    }

    public String getReceiveStartTime() {
        return receiveStartTime;
    }

    public void setReceiveStartTime(String receiveStartTime) {
        this.receiveStartTime = receiveStartTime;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getUseEndTime() {
        return useEndTime;
    }

    public void setUseEndTime(String useEndTime) {
        this.useEndTime = useEndTime;
    }

    public String getUseStartTime() {
        return useStartTime;
    }

    public void setUseStartTime(String useStartTime) {
        this.useStartTime = useStartTime;
    }

    public String getScope() {
        return scope;
    }

    public void setScope(String scope) {
        this.scope = scope;
    }

    public String getName() {
        return LanaugeUtils.returnStrByLocation(name);
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getDiscount() {
        if (type.equals("折扣")) {
            return discount / 10;
        }
        return discount;
    }

    public void setDiscount(double discount) {
        this.discount = discount;
    }

    public boolean isReceived() {
        return received;
    }

    public void setReceived(boolean received) {
        this.received = received;
        notifyPropertyChanged(BR.received);
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getPrecondition() {
        return precondition;
    }

    public void setPrecondition(int precondition) {
        this.precondition = precondition;
    }
}
